import { writeFileSync } from 'node:fs'

import openapiTS from 'openapi-typescript'

import { resolve } from './util.js'

async function genTypes() {
  const file = resolve('/src/apis/schema.d.ts')
  const data = await openapiTS('http://127.0.0.1:7001/swagger-ui-json')

  writeFileSync(file, data, { encoding: 'utf-8' })
}
genTypes()
